import { IToolTipItem } from "../../../../../com/mui/manager/IToolTipItem";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ObjCreate } from "../../common/ObjCreate";
import { ToolTipsManager } from "../../../../../com/mui/manager/ToolTipsManager";
import { T60DefenseCopyConfig } from "../../../../../Message/Db/Tables/T60DefenseCopyConfig";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { Language } from "../../../../../extend/language/Language";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
import { Tooltip } from "../../common/tooltip/Tooltip";
import { BossConfig } from "../../../resource/BossConfig";
import { CopyConfig } from "../../../resource/CopyConfig";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
import { GLabel } from "../../../../../com/mui/controls/GLabel";
type int = number;
//class SixtyCopyBuildBase
    
    export  class SixtyCopyBuildBase /* flash.display.Sprite */ implements IToolTipItem
    {
        constructor()
        {
            
            this._bg = ResouceConst.getScaleBitmap(ImagesConst.PackItemBg);
            this._bg.setSize(66, 66);
            this.addChild(this._bg);
            this._bossBm = new Object /* flash.display.Bitmap */();
            this._bossBm.x = 3;
            this._bossBm.y = 3;
            this._bossBm.width = 60;
            this._bossBm.height = 60;
            this.addChild(this._bossBm);
            this._numLabel = ObjCreate.createLabel("", 0, 2, 65, 20, flash.text.TextFormatAlign.LEFT, this, true, 16776960);
            this._levelLabel = ObjCreate.createLabel("", 0, 47, 65, 20, flash.text.TextFormatAlign.RIGHT, this, true, 16776960);
            ToolTipsManager.register(this);
            return;
        }

        public updateInfo(arg1: T60DefenseCopyConfig, arg2: int): void
        {
            this._configInfo = arg1;
            LoaderHelp.setBitmapdata(arg1.showIcon + ".jpg", this._bossBm, 0, 0, 60, 60);
            this._numLabel.htmlText = Language.getStringByParam(60384, arg2);
            this._levelLabel.htmlText = "Lv." + arg1.level;
            return;
        }

        public get toolTipData()
        {
            var loc1="";
            if (this._configInfo) 
            {
                loc1 = this.getTooltipString(this._configInfo);
            }
            return new ToolTipInfo(Tooltip.ToolTipRenderType_ShortcutItem, loc1);
        }

        public set toolTipData(arg1)
        {
            this._toolTipData = arg1;
            return;
        }

        /* internal  */getTooltipString(arg1: T60DefenseCopyConfig): string
        {
            var loc4=null;
            var loc1="";
            var loc2=BossConfig.instance.getInfoByCode(arg1.bossCode);
            if (loc2) 
            {
                loc1 = loc1 + ("<font size=\'14\' color=\'#FFFF00\'>" + loc2.boss.name + "</font>    Lv." + arg1.level + "\n");
            }
            var loc3=CopyConfig.instance.isHighestLevelBoss(arg1);
            if (arg1.level != 0) 
            {
                if (loc3) 
                {
                    loc1 = loc1 + (Language.getString(60374) + "\n");
                }
            }
            else 
            {
                loc1 = loc1 + (Language.getString(60373) + "\n");
            }
            loc1 = loc1 + "\n";
            if (arg1.level > 0) 
            {
                loc1 = loc1 + (Language.getStringByParam(60371, arg1.useSocore) + "\n");
                loc1 = loc1 + (HTMLUtil.addColor(Language.getString(60372), GlobalStyle.color5) + "\n");
                loc1 = loc1 + (arg1.desc + "\n\n");
            }
            if (!loc3) 
            {
                loc1 = loc1 + (HTMLUtil.addColor(Language.getStringByParam(60375, arg1.upgradeSocore), GlobalStyle.color2) + "\n");
                loc1 = loc1 + (HTMLUtil.addColor(Language.getString(60372), GlobalStyle.color5) + "\n");
                loc4 = CopyConfig.instance.get60DefenceConfig(arg1.copyCode, arg1.type, arg1.level + 1);
                loc1 = loc1 + (loc4.desc + "\n\n");
            }
            loc1 = loc1 + (this.getCareerDesc(arg1.type) + "\n");
            loc1 = loc1 + HTMLUtil.addColor(Language.getString(60385), "#FFFF00");
            return HTMLUtil.addColor(loc1, "#FFFFFF");
        }

        /* internal  */getCareerDesc(arg1: int): string
        {
            var loc1=arg1;
            switch (loc1) 
            {
                case 1:
                {
                    return Language.getString(60387);
                }
                case 2:
                {
                    return Language.getString(60388);
                }
                case 3:
                {
                    return Language.getString(60389);
                }
                case 4:
                {
                    return Language.getString(60390);
                }
                default:
                {
                    return "";
                }
            }
        }

        /* internal */ /* var */_configInfo: T60DefenseCopyConfig;

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_bossBm: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_numLabel: GLabel;

        /* internal */ /* var */_levelLabel: GLabel;

        /* internal */ /* var */_toolTipData;
    }
